<template>
	<view :data-theme="theme" class="container">
		<!-- <view class="header">
			<view class="card">
				<view class="header-top">
					<view class="title-font-weight">
						可提现金额(元)
					</view>
				</view>
				<view class="header-top">
					<view style="color: #000;font-weight: bold;" @click="goApplyClosing()">
						<span>{{baseManage.transferBalance ? baseManage.transferBalance : '0.00'}}</span>
						<image style="width: 30rpx;height: 32rpx;" src="/static/my/images/my_40_40.jpg"
							mode="scaleToFill" border="0" class="right">
						</image>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="header-top">
					<view class="title-font-weight">
						钱包余额
					</view>
					<view class="flat-right" style="display: flex;">
						<span style="padding: 0 40rpx;display: block;" @click="goBaseRecord()">
							<u-icon name="rmb" color="#000" size="22"></u-icon>
						</span>
						<span style="padding: 0 40rpx 0 20rpx;display: block;" @click="goApplyClosing()">
							<u-icon name="rmb-circle" color="#000" size="22"></u-icon>
						</span>
						<span style="padding: 0 60rpx 0 30rpx;display: block;" @click="goSettlement()">
							<u-icon name="rmb-circle" color="#000" size="22"></u-icon>
						</span>
					</view>
				</view>
				<view class="header-top" style="margin-top: -20rpx;">
					<view style="color: #000;" @click="goFundsFlow()">
						<span>{{baseManage.balance ? baseManage.balance : '0.00'}}</span>
						<image style="width: 30rpx;height: 32rpx;" src="/static/my/images/my_40_40.jpg"
							mode="scaleToFill" border="0" class="right">
						</image>
					</view>
					<view class="flat-right" style="display: flex;">
						<span style="padding: 0 20rpx;" @click="goBaseRecord()">对账</span>
						<span style="padding: 0 20rpx;" @click="goApplyClosing()">提现</span>
						<span style="padding: 0 20rpx;" @click="goSettlement()">结算设置</span>
					</view>
				</view>
				<view class="header-content" style="padding-bottom: 20rpx;">
					<view class="content-left" style="color: #000;font-weight: 16rpx;">
						保证金金额
					</view>
					<view class="content-right">
						{{baseManage.guaranteedAmount}}元
					</view>
				</view>
			</view>
		</view> -->
		<view class="my-account">
			<view class='wrapper'>
				<view class='header'>
					<view class='headerCon'>
						<view class='account acea-row row-top row-between'>
							<view class='assets'>
								<view>可提现金额(元)</view>
								<view class='money' @click="goApplyClosing()">
									{{baseManage.transferBalance ? baseManage.transferBalance : '0.00'}}
								</view>
							</view>
							<view class='recharge font_color'>充值</view>
						</view>
						<view class='cumulative acea-row row-top'>
							<view class='item'>
								<view>钱包余额(元)</view>
								<view class='money' @click="goFundsFlow()">
									{{baseManage.balance ? baseManage.balance : '0.00'}}
								</view>
							</view>
							<view class='item'>
								<view>保证金金额(元)</view>
								<view class='money'>
									{{baseManage.guaranteedAmount ? baseManage.guaranteedAmount : '0.00'}}
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class='nav acea-row row-middle'>
					<navigator class='item' hover-class='none' url='/pages/finance/baseRecordList/baseRecordList'>
						<view class='pictrue'>
							<text class="iconfont icon-s-zhangdanjilu icon_txt"></text>
						</view>
						<view>余额记录</view>
					</navigator>
					<navigator class='item' hover-class='none'
						:url="'/pages/finance/applyClosing/applyClosing?data=' + JSON.stringify(this.baseManage)">
						<view class='pictrue'>
							<text class="iconfont icon-s-chongzhijilu icon_txt"></text>
						</view>
						<view>前往提现</view>
					</navigator>
					<navigator class='item' hover-class='none' url='/pages/finance/fundsFlow/fundsFlow'>
						<view class='pictrue'>
							<text class="iconfont icon-jifenzhongxin icon_txt"></text>
						</view>
						<view>资金流水</view>
					</navigator>
					<navigator class='item' hover-class='none' url='/pages/finance/settlementInfo/settlementInfo'>
						<view class='pictrue'>
							<text class="iconfont icon-s-xiaofeijilu icon_txt"></text>
						</view>
						<view>结算设置</view>
					</navigator>
				</view>
			</view>
		</view>


		<swiper class="tab-view">
			<swiper-item style="display: flex;">
				<!-- 这里是可滚动的内容 -->
				<scroll-view class="scroll-view" scroll-y @scrolltolowerFn="scrolltolowerFn" style="height: 100%; ">
					<view class="title-font-weight" style="margin-left: 20rpx;margin: 20rpx;">
						结算流水
					</view>
					<view class="scroll-view-inner"> <!-- 内容区域 -->
						<view class="card" v-for="(item,index) in dataList" :key="index">
							<view class="title-content">
								<!-- <view
									style="display: flex;padding: 20rpx 20rpx 0 20rpx; justify-content: space-between;">
									<view class="title">
										订单号{{item.orderNo}}
									</view>
									<view class="title-c" style="padding: 10rpx;border-radius: 8rpx;color: #201b8c;">
										ID:{{item.id}}
									</view>
								</view> -->
								<view class="column"
									style="display: flex;justify-content: space-between;padding: 10rpx;">
									<view class="font-weight-content">
										{{item.nickName}}|{{item.uid}}
									</view>
									<!-- <view class="font-weight-content">
											{{closingDetail.amount}}元
										</view> -->
								</view>
								<view style="border-bottom: 1px solid #f6f6f6;margin: 20rpx;"></view>
								<view style="display: flex;padding:10rpx;justify-content: space-between;">
									<view class="title">
										金额
									</view>
									<view class="title-c" style="color: #201b8c;">
										<span v-if="item.pm == 0">-{{item.amount}}</span>
										<span v-else-if="item.pm == 1">+{{item.amount}}</span>
									</view>
								</view>
								<view style="display: flex;padding: 10rpx;justify-content: space-between;">
									<view class="title">
										交易时间
									</view>
									<view class="title-c">
										{{item.createTime}}
									</view>
								</view>
								<view style="border-bottom: 1px solid #f6f6f6;margin: 20rpx;"></view>
							</view>
						</view>
					</view>
				</scroll-view>
			</swiper-item>
		</swiper>

	</view>
</template>

<script>
	import {
		getFundsFlowApi
	} from '@/api/finance.js';
	import {
		setThemeColor
	} from '../../../utils/setTheme';
	let app = getApp();
	export default {
		data() {
			return {
				bgColor: "#ffffff",
				theme: app.globalData.theme,
				baseManage: {},
				cancellForm: {
					page: 1,
					limit: 10,
				},
				dataList: [],
			};
		},
		onLoad(options) {
			this.bgColor = setThemeColor()
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: this.bgColor,
			});
			this.baseManage = JSON.parse(options.data);
			this.getFundsFlowList();
		},
		methods: {
			// --------api------获取数据
			getFundsFlowList(isMerge) {
				let that = this;
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				if (!isMerge) {
					this.cancellForm.page = 1;
					this.loadMoreStatus = 'more';
				};
				getFundsFlowApi(this.cancellForm).then((res) => {
					let data = res.data;
					if (isMerge) {
						that.$util.SplitArray(data.list, that.dataList);
					} else {
						that.dataList = data.list;
					}
					that.totalPage = data.totalPage;
					if (data.totalPage == this.cancellForm.page) {
						that.loadMoreStatus = 'noMore';
					}
					uni.hideLoading();
				})
			},


			// 去提现
			goApplyClosing() {
				this.goPage(`/pages/finance/applyClosing/applyClosing?data=${JSON.stringify(this.baseManage)}`)
			},
			// 去对账
			goBaseRecord() {
				this.goPage(`/pages/finance/baseRecordList/baseRecordList`)
			},
			// 去结算
			goSettlement() {
				this.goPage(`/pages/finance/settlementInfo/settlementInfo`)
			},
			goFundsFlow() {
				this.goPage(`/pages/finance/fundsFlow/fundsFlow`)
			},
			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		}
	}
</script>

<style lang="scss">
	.bg_color {
		@include main_bg_color(theme);
	}

	page {
		height: 100%;
	}

	.container {
		display: flex;
		flex-direction: column;
		height: 100%;
	}

	.header {
		// background-color: #fff;
		@include main_bg_color(theme);
	}

	.tab-view {
		display: flex;
		flex-direction: column;
		flex: 1;
	}


	// .scroll-view {
	// 	height: 100%;
	// }

	.card {
		margin: 20rpx;
		border-radius: 10rpx;
		background-color: #fff;

	}

	.header-top {
		display: flex;
		justify-content: space-between;
		padding: 20rpx;
	}

	.title-font-weight {
		font-weight: bold;
		font-size: 34rpx
	}

	.header-content {
		display: flex;
		justify-content: space-between;
		margin: 0 20rpx;
	}

	.my-account .wrapper {
		background-color: #fff;
		padding: 32rpx 0 15rpx 0;
	}

	.my-account .wrapper .header {
		width: 690rpx;
		height: 330rpx;
		@include main_bg_color(theme);
		border-radius: 16rpx;
		margin: 0 auto;
		box-sizing: border-box;
		color: rgba(255, 255, 255, 0.6);
		font-size: 24rpx;
	}

	.my-account .wrapper .header .headerCon {
		background-image: url('');
		background-repeat: no-repeat;
		background-size: 100%;
		height: 100%;
		width: 100%;
		padding: 36rpx 0 29rpx 0;
		box-sizing: border-box;
	}

	.my-account .wrapper .header .headerCon .account {
		padding: 0 35rpx;
	}

	.my-account .wrapper .header .headerCon .account .assets .money {
		font-size: 72rpx;
		color: #fff;
		font-family: 'Guildford Pro';
	}

	.my-account .wrapper .header .headerCon .account .recharge {
		font-size: 28rpx;
		width: 150rpx;
		height: 54rpx;
		border-radius: 27rpx;
		background-color: #fff9f8;
		text-align: center;
		line-height: 54rpx;
	}

	.font_color {
		@include main_color(theme);
	}

	.icon_txt {
		font-size: 43rpx;
		@include main_color(theme);
	}

	.my-account .wrapper .header .headerCon .cumulative {
		margin-top: 46rpx;
	}

	.my-account .wrapper .header .headerCon .cumulative .item {
		flex: 1;
		padding-left: 35rpx;
	}

	.my-account .wrapper .header .headerCon .cumulative .item .money {
		font-size: 48rpx;
		font-family: 'Guildford Pro';
		color: #fff;
		margin-top: 6rpx;
	}

	.my-account .wrapper .nav {
		height: 155rpx;
		border-bottom: 1rpx solid #f5f5f5;
	}

	.my-account .wrapper .nav .item {
		flex: 1;
		text-align: center;
		font-size: 26rpx;
		color: #999;
	}

	.my-account .wrapper .nav .item .pictrue {
		width: 44rpx;
		height: 44rpx;
		margin: 0 auto;
		margin-bottom: 20rpx;
	}

	.my-account .wrapper .nav .item .pictrue image {
		width: 100%;
		height: 100%;
	}

	.my-account .wrapper .advert {
		padding: 0 30rpx;
		margin-top: 30rpx;
	}

	.my-account .wrapper .advert .item {
		background-color: #fff6d1;
		width: 332rpx;
		height: 118rpx;
		border-radius: 10rpx;
		padding: 0 27rpx 0 25rpx;
		box-sizing: border-box;
		font-size: 24rpx;
		color: #e44609;
	}

	.my-account .wrapper .advert .item.on {
		background-color: #fff3f3;
		color: #e96868;
	}

	.my-account .wrapper .advert .item .pictrue {
		width: 78rpx;
		height: 78rpx;
	}

	.my-account .wrapper .advert .item .pictrue image {
		width: 100%;
		height: 100%;
	}

	.my-account .wrapper .advert .item .text .name {
		font-size: 30rpx;
		font-weight: bold;
		color: #f33c2b;
		margin-bottom: 7rpx;
	}

	.my-account .wrapper .advert .item.on .text .name {
		color: #f64051;
	}

	.my-account .wrapper .list {
		padding: 0 30rpx;
	}

	.my-account .wrapper .list .item {
		margin-top: 44rpx;
	}

	.my-account .wrapper .list .item .picTxt .iconfont {
		width: 82rpx;
		height: 82rpx;
		border-radius: 50%;
		background-image: linear-gradient(to right, #ff9389 0%, #f9776b 100%);
		text-align: center;
		line-height: 82rpx;
		color: #fff;
		font-size: 40rpx;
	}

	.my-account .wrapper .list .item .picTxt .iconfont.yellow {
		background-image: linear-gradient(to right, #ffccaa 0%, #fea060 100%);
	}

	.my-account .wrapper .list .item .picTxt .iconfont.green {
		background-image: linear-gradient(to right, #a1d67c 0%, #9dd074 100%);
	}

	.my-account .wrapper .list .item .picTxt {
		width: 428rpx;
		font-size: 30rpx;
		color: #282828;
	}

	.my-account .wrapper .list .item .picTxt .text {
		width: 317rpx;
	}

	.my-account .wrapper .list .item .picTxt .text .infor {
		font-size: 24rpx;
		color: #999;
		margin-top: 5rpx;
	}

	.my-account .wrapper .list .item .bnt {
		font-size: 26rpx;
		color: #282828;
		width: 156rpx;
		height: 52rpx;
		border: 1rpx solid #ddd;
		border-radius: 26rpx;
		text-align: center;
		line-height: 52rpx;
	}

	.my-account .wrapper .list .item .bnt.end {
		font-size: 26rpx;
		color: #aaa;
		background-color: #f2f2f2;
		border-color: #f2f2f2;
	}
</style>